FSW     = fsw.x

#List of sources
C_FSW   = main.c ffts.c prep.c

# Compilers
CC      = gcc
LINK    = gcc
OPT     = -Ofast -std=c99

#-----------------------------
#generic

LIB_MPI         =
LIB_FFT         = -L/home/orange/fftw3libd/lib -lfftw3 -lm
INC_MPI         =
INC_FFT         = -I/home/orange/fftw3libd/include
LIB_ADD         =

ifeq ($(HOSTNAME), pequena)
        LIB_MPI         =
        LIB_FFT         = -lfftw3_mpi -lfftw3 -lm
        INC_MPI         =
        INC_FFT         =
endif
ifeq ($(HOSTNAME), metropolis.RR)
        LIB_MPI         =
        LIB_FFT         = -L/opt/local/fftw/3.3.1/mvapich2/1.7/intel/12.1/lib -lfftw3_mpi -lfftw3 -lm
        INC_MPI         =
        INC_FFT         =
endif

#-----------------------------

OBJ_FSW         = $(C_FSW:.c=.o) $(F_FSW:.f=.o)


LIB_FSW         = $(LIB_MPI) $(LIB_FFT) $(LIB_ADD)
INC_FSW         = $(INC_MPI) $(INC_FFT)

#-----------------------------

default: fsw

.f.o:
	$(FC) $(FFLAGS) -c $<


fsw:
	$(CC) $(OPT) $(DEF_FSW) $(INC_FSW) -c $(C_FSW)
	$(LINK) $(OPT) $(OBJ_FSW) $(LIB_FSW) -o $(FSW)

hostname:
	@echo $(HOSTNAME) $(INC_FFT)

clean:
	@echo "cleaning ..."
	rm -f *~ *.o

#-------------------------------


